<?php
header("Content-type:text/html; charset=utf-8");

//商户订单号
$pBillNo = date('YmdHis') . mt_rand(100000,999999);

//商户交易日期
$pDate = date('Ymd');

//商户返回地址
$url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') ? 'https://' : 'http://';
$url .= str_ireplace('localhost', '127.0.0.1', $_SERVER['HTTP_HOST']) . $_SERVER['SCRIPT_NAME'];
$url = str_ireplace('orderpay', 'OrderReturn', $url);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="content-Type" content="text/html; charset=utf-8" />
    <title>标准商户订单支付接口(新接口)</title>
    <style type="text/css">
      <!--
      TD {FONT-SIZE: 9pt}
      SELECT {FONT-SIZE: 9pt}
      OPTION {COLOR: #5040aa; FONT-SIZE: 9pt}
      INPUT {FONT-SIZE: 9pt}
      -->
    </style>
	<script language="javascript">
		function show(zhilian)
		{
			var obj = document.getElementById("tb1");

			if(zhilian == "1")
			{
				for(i=14; i<20; i++)
				{
					obj.rows[i].style.display = "block";
				}

				obj.rows[20].style.display = "none";
				obj.rows[21].style.display = "none";
			}
			else
			{
				for(i=14; i<20; i++)
				{
					obj.rows[i].style.display = "none";
				}

				obj.rows[20].style.display = "block";
				obj.rows[21].style.display = "block";
			}
		}
	</script>
  </head>
  <body>
    <form id="form1" action="redirect.php" method="post" target="_blank" >
      <table id="tb1" width="400" border="1" cellspacing="0" cellpadding="3" bordercolordark="#FFFFFF" bordercolorlight="#333333" bgcolor="#F0F0FF" align="center">
        <tr bgcolor="#8070FF"> 
          <td colspan="2" align="center">
            <font color="#FFFF00"><b>商户模拟测试(模拟交易接口)</b></font>
          </td>
        </tr>
        <tr>
          <td>商户号</td>
          <td>
            <input type="text" name="pMerCode" size="18" value="120039" /><!--测试商户号-->
          </td>
        </tr>
        <tr> 
          <td>订单号</td>
          <td>
            <input type="text" name="pBillNo" size="24" value="<?php echo $pBillNo; ?>" />
          </td>
        </tr>
        <tr> 
          <td>支付币种</td>
          <td>
            <input type="text" name="pCurrency" size="16" value="RMB" />
          </td>
        </tr>
        <tr> 
          <td>语言</td>
          <td>
            <select name="pLang" style="width:115px">
              <option value="GB">GB中文</option>
              <option value="EN">英语</option>
            </select>
          </td>
        </tr>
        <tr> 
          <td>金&nbsp;&nbsp;额</td>
          <td>
            <input type="text" name="pAmount" size="16" value="0.10" />
          </td>
        </tr>
        <tr> 
          <td>日&nbsp;&nbsp;期</td>
          <td>
            <input type="text" name="pDate" size="16" value="<?php echo $pDate; ?>" />
          </td>
        </tr>
		<tr> 
          <td>订单有效期(小时)</td>
          <td>
            <input type="text" name="pBillEXP" size="16" value="1" />
          </td>
        </tr>
        <tr> 
          <td>访问者权限</td>
          <td>
            <input type="text" name="pAuthority" size="16" value="" />
          </td>
        </tr>
        <tr> 
          <td>持卡人姓名</td>
          <td>
            <input type="text" name="pName" size="16" value="Dale" />
          </td>
        </tr>
        <tr> 
          <td>持卡人证件类型</td>
          <td>
            <select name="pIDType">
              <option value="1" selected="selected">身份证</option>
              <option value="2">护照</option>
              <option value="3">军官证</option>
              <option value="4">回乡证</option>
              <option value="5">台胞证</option>
              <option value="6">港澳通行证</option>
              <option value="7">国际海员证</option>
              <option value="8">外国人永久居住证</option>
              <option value="9">其他</option>
            </select>
          </td>
        </tr>
        <tr> 
          <td>持卡人证件号码</td>
          <td>
            <input type="text" name="pIDNum" size="24" value="123456789012345678" />
          </td>
        </tr>
        <tr> 
          <td>持卡人电话</td>
          <td>
            <input type="text" name="pTel" size="16" value="62107829" />
          </td>
        </tr>
        <tr> 
          <td>是否直连</td>
          <td>
            <select name="pDirect" style="width:115px" onchange="show(this.value)">
              <option value="1">直连</option>
              <option value="" selected="selected">非直连</option>              
            </select>
          </td>
        </tr>
		<tr> 
		  <td>网关号</td>
		  <td>
			<input type="text" name="pCardType" size="16" value="" />
		  </td>
		</tr>
		<tr> 
		  <td>发卡行</td>
		  <td>
			<input type="text" name="pIssueBank" size="16" value="" />
		  </td>
		</tr>
		<tr> 
		  <td>发卡行国家</td>
		  <td>
			<input type="text" name="pIssueCountry" size="16" value="" />
		  </td>
		</tr>
		<tr> 
		  <td>信用卡号</td>
		  <td>
			<input type="text" name="pCardNum" size="20" value="" />
		  </td>
		</tr>
		<tr> 
		  <td>信用卡有效期(MM/YY)</td>
		  <td>
			<input type="text" name="pCardExp" size="16" value="" />
		  </td>
		</tr>
		<tr> 
		  <td>CVV2</td>
		  <td>
			<input type="text" name="pCVV" size="3" value="" />
		  </td>
		</tr>
		<tr> 
		  <td>授权录入成功返回地址</td>
		  <td>
			<input type="text" name="pAuthSuccessUrl" size="35" value="<?php echo $url; ?>" />
		  </td>
		</tr>
		<tr> 
		  <td>授权录入失败返回地址</td>
		  <td>
			<input type="text" name="pAuthFailureUrl" size="35" value="" />
		  </td>
		</tr>
        <tr> 
          <td>网关类型</td>
          <td>
            <select name="pGateWayType" style="width:115px">
              <option value="1">国内信用卡</option>
              <option value="2">国际信用卡</option>
            </select>
          </td>
        </tr>
        <tr> 
          <td>订单加密方式</td>
          <td>
            <select name="pOrderEncodeType" style="width:115px">
              <option value="1" selected="selected">RSA</option>
              <option value="2">3DES</option>
            </select>
          </td>
        </tr>
        <tr> 
          <td>商品信息(名称|摘要)</td>
          <td>
            <input type="text" name="pGoodsInfo" size="16" value="测试商品|测试摘要" />
          </td>
        </tr>
        <tr> 
          <td>商户附加信息</td>
          <td>
            <input type="text" name="pAttach" size="16" value="test" />
          </td>
        </tr>
        <tr>
          <td colspan=2 align=center>
            <font color=red>以下是新增的接口参数</font>
          </td>
        </tr>
        <tr> 
          <td>交易返回加密方式</td>
          <td>
            <select name="pRetEncodeType" style="width:115px">
              <option value="11">md5withRsa</option>
              <option value="12" selected="selected">md5摘要</option>
            </select>
          </td>
        </tr>
        <tr> 
          <td>错误信息返回地址</td>
          <td>
            <input type="text" name="pErrorUrl" size="35" value="" />
          </td>
        </tr>
        <tr>
          <td>成功返回的商户URL</td>
          <td>
            <input type="text" name="pReturnUrl" size="35" value="<?php echo $url; ?>" />
          </td>
        </tr>
        <tr> 
          <td colspan="2" align="center"><input type="submit" value="submit" /></td>
        </tr>
      </table>
    </form>
	<script language="javascript">
		show("");
	</script>
  </body>
</html>